package com.rt.generalframework.core.util;

import com.github.pagehelper.Page;
import com.rt.global.ErrorCode;
import com.rt.global.JsonResult;
import com.rt.global.PageVO;

/**
 * TODO().
 *
 * <p>TODO().
 *
 * <p>版权所有:Copyright (c) 2019<br/>
 * <a href="http://www.wiseimage.cn/">广州易联众睿图信息技术有限公司</a>.
 *
 * @author 周昭名
 * @version V1.0
 * @since 2019/9/23 11:36
 */
public class PageResultUtil {
    /**
      *
      *TODO(分页处理工具类).
      *
      *<p>TODO(分页处理工具类).
      *
      *@return
      *@author 周昭名
      *@since 2019/9/23 11:36
    */
    public static JsonResult success(String message, Object result, Page page) {
        PageVO pageVO = new PageVO();
        pageVO.setPageNo(page.getPageNum());
        pageVO.setPages(page.getPages());
        pageVO.setPageSize(page.getPageSize());
        pageVO.setTotal(page.getTotal());
        return (new JsonResult()).setStatus(ErrorCode.SUCCESS.key).setMessage(message).setResult(result).setPage(pageVO);
    }
}
